<template>
123
</template>

/**
*
* 页面跳转外链
* 1. pc端直接点开链接 https://open.weixin.qq.com/connect/qrconnect?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect
* 2. 前端发送请求给后端，后端返回二维码链接地址
*
* 以下的代码展示主要是介绍第二点，这边以vue3为例
*/
<script setup>
import { reactive, onMounted } from 'vue'
import { api } from '/@/api/wechat/index.ts'
const state = reactive({
  wechat: {
    url: ''
  }
});

// 获取微信登录二维码
const getWechatCode = () => {
  api().then((res) => {
    if (res.code == 200) {
      state.wechat.url = res.data.url
    }
  });
}

// 页面挂载时
onMounted(() => {
  getWechatCode();
});
</script>
